package acwing._1_1AlgorithmBasic._4Math;
/**
 * @Project : AlgorithmLearning
 * @Package : ACWing._1_1AlgorithmBasic._4Math
 * @File : Q0869.java
 * @Author : WangRuoyu
 * @Date : 2023/4/4 14:26
 */

import java.io.*;
import java.util.ArrayList;

public class Q0869 {

    static ArrayList<Integer> getDivisors(int n) {
        ArrayList<Integer> res = new ArrayList<>();
        for (int i = 1; i <= n / i; ++i) {
            if (n % i == 0) {
                res.add(i);
                if (i != n / i) {
                    res.add(n / i);
                }
            }
        }
        res.sort((o1, o2) -> o1 - o2);
        return res;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] words = br.readLine().split(" ");
        int n = Integer.parseInt(words[0]);
        for (int i = 0; i < n; ++i) {
            words = br.readLine().split(" ");
            int k = Integer.parseInt(words[0]);
            ArrayList<Integer> res = getDivisors(k);
            for (Integer re : res) {
                wr.write(re + " ");
            }
            wr.write("\n");
        }
        wr.flush();
    }
}

